package com.hontech.bv.conn.api

import com.hontech.bv.conn.Proto
import com.hontech.bv.conn.SerialPortMod
import com.hontech.bv.conn.serial.Uint8

object Ice {

    suspend fun drawCtrl(type: Int) {
        SerialPortMod.request(
            Proto.REQ_ICE_DRAW_CTRL,
            Proto.ID_ICE,
            arrayOf(Uint8(type))
        ).assert("抽水控制")
    }

    suspend fun makeCtrl(type: Int) {
        SerialPortMod.request(
            Proto.REQ_ICE_MAKE_CTRL,
            Proto.ID_ICE,
            arrayOf(Uint8(type))
        ).assert("制冰控制")
    }

    suspend fun testParts(type: Int, value: Int) {
        SerialPortMod.request(
            Proto.REQ_ICE_PARTS_CTRL,
            Proto.ID_ICE,
            arrayOf(Uint8(type), Uint8(value))
        ).assert("测试组件")
    }

    suspend fun dropIce(sec: Int) {
        SerialPortMod.request(
            Proto.REQ_ICE_DROP_ICE,
            Proto.ID_ICE,
            arrayOf(Uint8(sec))
        ).assert("出冰")
    }
}


